//
//	(c) 2009 Andrew Kalmacky
//

#ifndef _AK_STRING_TEST_H_
#define _AK_STRING_TEST_H_

#include "../logger/logger.h"
#include "../string/ltm_string.h"

#define CHECK(COND) log::info::assert((COND), STR(COND) T_(" ") STR(__FILE__) T_(":") STR(__LINE__))

namespace string_test
{
    using ak::string::string;
	using ak::string::temp_str;

    typedef Log::Logger<struct LtmTest, Log::lv_Verbose> log;

    struct StringTest
    {
        StringTest()
        {
            ak::ltm::copy_solver thread_solver;
			temp_string_test();
			strings_in_structs();
        }
		struct st
		{
			string a;
			string b;
			st(const temp_str& a, const temp_str& b)
				: a(a), b(b)
			{
			}
		};
		void temp_string_test()
		{
            temp_str s;
            CHECK(s.size() == 0);
            temp_str s1;
            CHECK(s1.size() == 0);
            s = temp_str(T_("test"), 12, s, T_('!'));
            CHECK(s == T_("test12!"));
            bool r = s1 == s;
            CHECK(r == false);
            log::info("ok");
		}
		void strings_in_structs()
		{
			st s(T_("qwerty"), T_("ASDF"));
			CHECK(s.a == T_("qwerty"));
		}
    } test;
}
template<>
const char_t* const string_test::log::prefix = T_("[string_test]");

#endif // _AK_STRING_TEST_H_
